<template>
  <div class="dashboard-container">
    <component :is="currentRole" />
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import Merchant from './merchant'
import Canteen from './canteen'

export default {
  name: 'Dashboard',
  components: {Canteen,Merchant },
  data() {
    return {
      currentRole: ''
    }
  },
  computed: {
    ...mapGetters([
      'roles'
    ])
  },
  created() {
    this.roles.forEach(res =>{
      if (res==='merchant') {
        this.currentRole = 'Merchant'
      }
      if (res==='canteen') {
        this.currentRole = 'Canteen'
      }
      if (res==='merchant-schedule') {
        this.currentRole = 'Schedule'
      }

    })

  }
}
</script>
